package org.musicsweet.controller;

import org.musicsweet.anotation.AuthReq;
import org.musicsweet.entity.MusicSinger;
import org.musicsweet.result.ResultData;
import org.musicsweet.service.MusicSingerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 歌手Controller
 */
@RestController
@RequestMapping("/musicSinger")
public class MusicSingerController {

    @Autowired
    private MusicSingerService musicSingerService;

    /**
     * 根据id查询歌手
     *
     * @param musicSinger
     * @return
     */
    @AuthReq
    @RequestMapping("/getMusicSingerById")
    public ResultData<MusicSinger> getMusicSingerById(@RequestBody MusicSinger musicSinger) {
        return musicSingerService.getMusicSingerById(musicSinger);
    }

    /**
     * 多条件查询歌手
     *
     * @param musicSinger
     * @return
     */
    @AuthReq
    @RequestMapping("/getMusicSingerList")
    public ResultData<List<MusicSinger>> getMusicSingerList(@RequestBody MusicSinger musicSinger) {
        return musicSingerService.getMusicSingerList(musicSinger);
    }


    /**
     * 添加歌手
     *
     * @param musicSinger
     * @param token
     * @return
     */
    @RequestMapping("/addMusicSinger")
    public ResultData addMusicSinger(@RequestBody MusicSinger musicSinger, String token) {
        return musicSingerService.addMusicSinger(musicSinger, token);
    }


    /**
     * 修改歌手
     *
     * @param musicSinger
     * @param token
     * @return
     */
    @RequestMapping("/updateMusicSinger")
    public ResultData updateMusicSinger(@RequestBody MusicSinger musicSinger, String token) {
        return musicSingerService.updateMusicSinger(musicSinger, token);
    }


    /**
     * 删除歌手
     *
     * @param musicSinger
     * @return
     */
    @RequestMapping("/delMusicSinger")
    public ResultData delMusicSinger(@RequestBody MusicSinger musicSinger) {
        return musicSingerService.delMusicSinger(musicSinger);
    }

}